import React, { Component } from 'react'

export default class App extends Component {
  state = {
    count: 1,
  }
  render() {
    console.log('#1 render')
    return (
      <div>
        <p>{this.state.count}</p>
        <button onClick={() => this.setState({ count: this.state.count + 1 })}>
          按钮1
        </button>
        <button onClick={() => this.forceUpdate()}>按钮2</button>
      </div>
    )
  }
  componentDidUpdate() {
    // 获取更新完毕后的 DOM，不要直接调用 setState
    console.log('#2 componentDidUpdate')
  }
}
